Kameleon-Plus  0.3.2
Adapt3D.h
Go to the documentation of this file.
1 /*
2  * Adapt3D.h
3  *
4  * Created on: Oct 29, 2010
5  * Author: David Berrios
6  */
7 
8 #ifndef ADAPT3D_H_
9 #define ADAPT3D_H_
10 #include <string>
11 #include "Cell3D.h"
12 #include "Model.h"
13 #include "Constants.h"
14 #include "Point3f.h"
15 #include <vector>
16 #include <boost/unordered_map.hpp>
17 #include <boost/multi_array.hpp>
18 #include <string>
19 
20 #define NNODE_ADAPT3D 4
21 #define NVARS_ADAPT3D 12
22 #define NDIMN_ADAPT3D 3
23 #define INNER_RADIUS 1.0
24 #define OUTER_RADIUS 30.0
25 
26 #define nx_sg 100
27 #define ny_sg 100
28 #define nz_sg 100
29 #define nx_b 2
30 #define ny_b 2
31 #define nz_b 2
32 
33 //#define CARTESIAN_S_GRID
34 #define SPHERICAL_S_GRID
35 #define DELAUNEY_SEARCH
36 #define DELAUNEY_ITER_MAX 1000 /* new 11-16-11 */
37 
38 
39 namespace ccmc
40 {
41 
43  {
46  float dx_sg,dy_sg,dz_sg;
47  std::vector<int> * indx;
48  std::vector<int> * esup1;
49  std::vector<int> * esup2;
50  boost::multi_array<int, 3> nelems_in_cell;//(boost::extents[nz_sg][ny_sg][nx_sg]);
51  boost::multi_array<int, 3> nnodes_in_cell;//(boost::extents[nz_sg][ny_sg][nx_sg]);
52  boost::multi_array<int, 3> start_index;//(boost::extents[nz_sg][ny_sg][nx_sg]);
53  boost::multi_array<int, 3> start_index_nodes;//(boost::extents[nz_sg][ny_sg][nx_sg]);
54  boost::multi_array<int, 3> end_index;//(boost::extents[nz_sg][ny_sg][nx_sg]);
55  boost::multi_array<int, 3> end_index_nodes;//(boost::extents[nz_sg][ny_sg][nx_sg]);
56  std::vector<int> * indx_nodes;
57  //int still_in_same_element;
59  std::vector<int> * facing_elements;
60  //int outside_grid;
62  //BoundingBox * parent;
63  };
70  class Adapt3D: public Model
71  {
72 
73  public:
74  Adapt3D();
75  long open(const std::string& filename);
76 
79  //float * getModifiedCoords();
80  const std::vector<std::string> getLoadedVariables();
81 
82  virtual ~Adapt3D();
83 
84  /*template<typename T>
85  friend int binary_search(const std::vector<T>& vec, unsigned int start, unsigned int end, const T& key);*/
86 
87  protected:
89  void initializeSIUnits();
90 
91  private:
92  int ndimn;
93  int nnode;
94  int nvars;
95  int grid_reg_no, npoin, nelem, nboun, nconi;
96  long GRID_REG_NO_cdf_num, NPOIN_cdf_num, NELEM_cdf_num, NDIMN_cdf_num;
97  long NBOUN_cdf_num, NCONI_cdf_num;
98 
99  void smartSearchSetup();
100  bool setupSearchUnstructuredGrid();
101  void setupOctreeGrid();
102  std::vector<Point3f> vertices;
103  SmartGridSearchValues smartSearchValues;
104  std::vector<float> *coord_modified;
105  std::vector<int> * intmat_modified;
106  int index_2d_to_1d( int i1, int i2, int n);
107 
108  void locate_facing_elements();
109 
110 
111 
112 
113 
114 
115  };
116 }
117 
118 #endif /* ADAPT3D_H_ */